<?php  
session_start();

include_once($_SERVER['DOCUMENT_ROOT'].'/public/func.php');
$config=include_once($_SERVER['DOCUMENT_ROOT'].'/public/config.php');
 $name=$_POST['name'];
 $pass=md5($_POST['pass']);
  
 $res=sel($config,'users',"where name='$name'");
  if ($res[0]['name']==$name && $res[0]['pass']==$pass) {
 	$_SESSION['name']=$name;
 	$_SESSION['id']=$res[0]['id'];
 	$_SESSION['islogin']=1;
 	echo '<script>alert("登录成功");window.location.href="/home/index.php"</script>';
 }else{
 	echo '<script>alert("登录失败");window.location.href="/home/public/denglu.php"</script>';
 }


// $row = select($config,'vip',"where user = '$user'");
// if($user==$row[0]['user']&&$pass==$row[0]['pass']){
// 	$_SESSION['islogin']=1;
// 	$_SESSION['user']=$user;
// 	 echo '<script> alert("登录成功，跳转到首页"); window.location.href="index.php" </script>';
// 	}else{
// 	 echo '<script> alert("登录失败，请重新登录"); window.location.href="index.php" </script>';
// 	};



?>